
global.Promise = require('bluebird')
const request = Promise.promisifyAll(require('request'))

async function main() {
	const random = 1 + parseInt(Math.random() * 98)
	// https://www.coinw.me/kline/fulldepth.html?symbol=42&step=60&rand=80
	const url = `https://www.coinw.me/kline/fulldepth.html?symbol=42&step=60&rand=${random}`
	// const url = `https://www.coinw.com/real/priceTrend.html?random=${random}`

	const headers =  { "content-type": "application/json"}
	const body = {}

	const res = await request.postAsync(url, {headers, body, json: true})
	// console.log(Date.now(), random, res.body.depth)
	const {bids, asks} = res.body.depth
	console.log(bids[0][0], asks[0][0])
	await Promise.delay(25000)
	await main()
}

main()